
<!DOCTYPE html>
<html>
<body>
<form action="addvideo.php" method="POST">

<?php
 require "main.php"
?>

 Enter Youtube Url<br>
 <input type="text" name="link">
 <input type="submit" value="Submit">

</form>

<br>
<?php
 $seznam=fopen("playlist.txt","r");
 $arry=unserialize(fread($seznam,filesize("playlist.txt")));
 fclose($seznam);
 for ($x=0; $x<count($arry);$x++){
	$ref=$arry[$x]; 
      $json = file_get_contents('http://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=' . $ref . '&format=json'); //get JSON video details
      $details = json_decode($json, true); //parse the JSON into an array
      echo ($details['title']); //return the video title
	echo('<br>');

    } 



?>

</body>
</html>
